package com.elasticsearch.demo.repository;

import com.elasticsearch.demo.model.entity.SupportAddress;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Created by 瓦力.
 */
public interface SupportAddressRepository extends CrudRepository<SupportAddress, Long> {
    /**
     * 获取所有对应行政级别的信息
     * @return
     */
    List<SupportAddress> findAllByLevel(String level);

    /**
     * 获取所有对应地区级别的信息
     * @return
     */
    List<SupportAddress> findAllByLevelAndBelongTo(String level, String belongTo);

    /**
     * 按名字和级别查询地区信息
     * @param cityEnName
     * @param value
     * @return
     */
    SupportAddress findByEnNameAndLevel(String cityEnName, String value);

    /**
     * 通过名字属于该地区
     * @param regionEnName
     * @param enName
     * @return
     */
    SupportAddress findByEnNameAndBelongTo(String regionEnName, String enName);
}
